let allowedUrls = [
	'https://libc-ddanm.bujufangshi.com/Index/index',
	'https://libc-ddanm.bujufangshi.com/Shop/getList'
]

function getAllowedUrls(apiurl, data) {
	if (allowedUrls.includes(apiurl)) {
		// 执行替换操作
		const processedData = replaceUrlsInData(data);

		// 返回处理后的数据（根据实际需求使用）
		return processedData;
	}
}

function replaceUrlsInData(data) {
	if (typeof data === 'string') {
		return data.replace(
			/http:\/\/libc-ddanmo-file\.bujufangshi\.com/g,
			'https://libc-ddanmo-file.bujufangshi.com'
		);
	}

	if (Array.isArray(data)) {
		return data.map(item => this.replaceUrlsInData(item));
	}

	if (typeof data === 'object' && data !== null) {
		const newObj = {};
		for (const key in data) {
			newObj[key] = this.replaceUrlsInData(data[key]);
		}
		return newObj;
	}

	return data;
}

export default {
	getAllowedUrls,
	editUrl
}